I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy:Terrain Decoration Layer

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Terrain Decoration Layers apply static meshes to a terrain. Each decoration layer causes multiple copies of a particlar mesh to appear over the terrain. These are placed randomly, with the density of the meshes given by a texture, just as intensity of texture is given by a texture for texture layers.

Adding a TDL[edit]

The Terrain Painting Tool is a bit buggy when it comes to editing a decoration layer's alpha map. So here's a method to get around it:

  1. Before beginning, you should have a terrain created with a visible base texture, such as a grass layer. See Creating A Terrain
  2. You now need to create a Terrain Texture layer with a density map for your deco layer. First go to the Texture Browser and select some texture (it doesn't matter which, we won't be looking at it.) Open the terrain editor and select your terrain, then go to the layers tab and hit "new" to create a new texture layer. Call it something like "decolayer1alpha" Once the layer has been created, use the up arrow to move the layer to the bottom of the layer stack (to the top of the list.) This will ensure that whatever texture you've selected will not be drawn as a layer, but lets us edit the layer's alpha map which effectively changes the density on the deco layer.
    Alternatively, you could import an 8-bit grayscale texture from an external application. However, this takes more time, and you'll probably have to adjust this texture anyway to get the decorations exactly how you want them.
  3. Select a static mesh in the static mesh browser. This is the mesh that will appear wherever the density map is lighter.
  4. Go to the texture browser and select the "decolayer1alpha" texture that you created in step 2. Now you're ready.
  5. Click in the "Decorations" tab. Click "New". You should see a new row appear in the list box, with three red Xs. This represents your decoration layer.
  6. Right-click the row in the list -> Set Density Texture from Current
  7. Right-click the row in the list -> Set static mesh from Current
  8. Go back to camera mode in the toolbox, find your TerrainInfo actor and set the following properties
    • TerrainInfo -> DecoLayers -> [your layer's number] -> FadeOutRadius -> Min = 500
    • TerrainInfo -> DecoLayers -> [your layer's number] -> FadeOutRadius -> Max = 1200 (These numbers are just examples – you need to set the max higher than 0 so you can actually see the meshes in the editor. More details below)
  9. Now go back to the terrain editor, go to the layers tab, select the layer which controls the density map for your deco layer, and paint it as if you would paint a Terrain Texture Layer

Tarquin: Won't this add to the texture complexity of the terrain? Should you delete the texture layer before releasing the map?

Editing[edit]

As stated above, editing the density of the texture layer controlling the deco layer is exactly the same as using the "paint" tool on a Terrain Texture Layer Select the layer (not the deco layer!) and the paint tool Then use ctrl+lmb to make the deco layer more dense, and ctrl+rmb to make the area less dense.

Changing color and scale of static meshes[edit]

In addition to setting the density map for the texture, you can also use a texture to control the scale of individual meshes on your terrain, or a color map to change the tint of static meshes in different areas. Perhaps you want to use a grass texture, but you want certain areas to look like a bloody battlefield? this is the way to do it. The color map simply takes whatever color the original mesh looked like, and blends it with the color in the color map. This will be most apparent if your static mesh had a texture that was close to white, but can be used with any static mesh.

To set a color map, select the texture you want, then go to the terrain editor->decorations tab, right click the deco layer, and select "set color texture from current"

For the scale map, the R,G,B values determine the scale in the X,Y,Z directions respectively. This is probably easiest to do in a seperate image editor.

To set a scale map, select the texture you want, then go to the terrain editor->decorations tab, right click the deco layer, and select "set scale texture from current"

Properties[edit]

int AlignToTerrain 
If this is 0, then all the static meshes will stand straight up. Otherwise, they'll stick out from the slope of the terrain.
Texture ColorMap 
The optional color map which is streched over the terrain to modify the color of individual static meshes in the deco layer
Texture DensityMap 
The density map which controls how many static meshes will be in one area
range DensityMultiplier 
this is a range which you can use to tweak the density of the static meshes. Higher values will make the layer more dense.
int DisregardTerrainLighting 
setting this to a non-zero value will basically make all of the static meshes fully lit. This could be useful, for instance, if you wanted it to look like you had lots of little lights all over the ground...
ESortOrder DrawOrder 
This tells the engine how to sort the meshes before it draws them. Using Sort_BackToFront will probably give the results you want.
range FadeoutRadius 
This is a range which determines how to fade out the deco layer with distance. Anything less than the min distance value will be fully opaque, and anything greater thean the max will be fully translucent. Everything in-between will be slowly blended between the two. It's important to adjust this, along with the density of your deco layer to get the best balance between performance and asthetics.
int LitDirectional 
Setting this to a non-zero value will make the individual meshes use the level's sunlight, rather than just the light value on the terrain at that point. Use this!
int MaxPerQuad 
The maximum number of meshes in one quad on the terrain. Probably should be left alone for most purposes.
int RandomYaw 
Setting this to non-zero causes the meshes to have random yaw rotations, for more of a natural organic feel.
Texture ScaleMap 
The optional scale map which determines the size of individual meshes on the terrain. The R,G,B channels affect the X,Y,Z scales, so use a grayscale texture if you want to scale everything uniformly.
rangevector ScaleMultiplier 
This is useful for scaling all of the meshes on the layer. Actual scale value will be a random value somewhere between the min and max. Everything is set to 1 by default.
int Seed 
Changing this will generate a new random placement for the meshes, while still obeying the guidelines set by the density map.
int ShowOnInvisibleTerrain 
false by default, this allows you to show the static meshes even where the terrain has been set to invisible.
int ShowOnTerrain 
obvious.
StaticMesh StaticMesh 
The static mesh which is displayed by this deco layer.

Tips for creating deco layers[edit]

  • in the TerrainInfo actor properties, there is a value called "DecoLayerOffset". This is a global value for each terrain which defines the height above the terrain to move the static meshes. Unfortunately it affects all deco layers, but it can be useful if you're using a static mesh that needs the height to be adjusted somewhat.
  • The unreal engine is not very good about handling translucent objects, so beware that if you have other translucent actors in your game, they may get overdrawn totally by deco layers.
  • It's very important to find a good balance between performance and looks. If you want more dense meshes, then try fading them out sooner. If you want a more continuous look for something like a flight simulator, consider using relatively sparse density maps, but let things fade away further into the distance.
  • make sure if you're going for something like grass, to turn on litdirectional and random yaw, as well as giving the ScaleMultiplier a little room to mess with the scale. This will give your layer a much more organic and natural look.

Related Topics[edit]


Category:Legacy Mapping

Comments[edit]

Enos Shenk: Ive never had any trouble removing decorations. Just using the painting tool with my layer linked to my decolayer and control+rightclick un-paints them just like a texture layer.

Tarquin: I tried that, and control+rightclick seems to apply meshes same as control-left. This is UT2003 UnrealEd

Lilguy: Ok, pretty much did a total rewrite on the how to section, and using that method, it should solve your problem Tarquin.

Lilguy: Anything else someone would like to see here?

Tarquin: I like your workaround of using a hidden texture layer. Is the painting tool definitely b0rked for working on deco layers directly?

Lilguy: Yeah I think that they never intended it to be used that way...When I use the paint tool on a dec layer,it modifies the geometry...I'd like to take credit for the idea of using texture layers, but that's how I learned todo it in the 3Dbuzz vtm on terrain, and also how they do it on the udn site for deco layers.

Legal: Works fine for me... make sure that you've selected the decolayer before painting though. Btw, is there ANY way of creating decolayers with collision? Making an entire forest without DecoLayers can piss me off pretty much... :(

Tarquin: For me, painting a deco layer works when ADDING stuff, but not removing it. :(

Lilguy: strange, when I was playing with it yesterday, I couldn't get it to add anything when I actually had the deco layer selected. In any case, does using the texture layer method work for you? As far as collision, I *think* that using a static mesh with collision built in should solve the problem, but I could be wrong. I know in the official maps when they want to put things like trees in a map, they always just place the tree manually. I think deco layers are more indended for things like grass and things where exact placement doesn't really matter.

Otter: Say you wanted to have grass bend when you walk through it... is that possible using a terrain deco layer?

Foxpaw: No, I don't believe it is. You would probrably have to script custom grass actors.

Legal: No, not in any Unreal Engine game. I know Hidden and Dangerous 2 has it (it looks very awesome, very natural), but then again, it doesn't have an editor ;)

Otter: Ok then, how's this... animated meshes, ie grass that subtley blows in the wind?

Tarquin: Static meshes can't animate

Erdrik: I thought it might be important to note that the rangevector ScaleMultiplier is not set to 1 by default.

(at least not in my editor...) I had spent an hour or so after following the above steps trying to figure out why my

deco's weren't working, eventually discovering that at a scale of 0 the certainly wouldn't be visable. :P lol

Aaack! If you saw it I apologies for the horror I unleashed to this page I hope I fixed it... <:(

Tarquin: If it is not set to 1 by default, then please correct the information in the main body of the page.

V3rt1go: The VTMs (if you believe them) say you should only paint on the layer under the layers tab, and that painting on the deco layer itself can cause problems.

Citruspunch: Can't see the grass? Ensure you've actually told unreal to display foliage. I have a low spec system and couldn't figure out whiy this wasn't showing up.